﻿<%@ Page Title="Offices" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Offices.aspx.cs" Inherits="IFD2.Offices" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <form id="form1" runat="server" role="form" class="form-inline" defaultbutton="lbtnQuery">
    <div class="container-fluid body-content" style="width:100%;">

    <div class="row">
        <div class="col-sm-2 well well-sm">
            <h5><asp:Literal ID="litTitle" runat="server" meta:resourcekey="tipPageTitle"></asp:Literal></h5>
            <div class="form-group">
                <asp:Label ID="Label1" runat="server" Text="Office Type:" meta:resourcekey="OfficeType"></asp:Label>
                <asp:DropDownList ID="lstOfficeTypes" runat="server" CssClass="form-control input-sm" Width="100%">
                    <asp:ListItem Value="COR" meta:resourcekey="CoreDept">Core Dept.</asp:ListItem>
                    <asp:ListItem Value="NET" meta:resourcekey="NetworkDept">Network Dept.</asp:ListItem>
                    <asp:ListItem Value="FAR" meta:resourcekey="FareDept">Fare Dept.</asp:ListItem>
                    <asp:ListItem Value="INV" meta:resourcekey="InventoryDept">Inventory Dept.</asp:ListItem>
                    <asp:ListItem Value="DEP" meta:resourcekey="DepartureDept">Departure Dept.</asp:ListItem>
                    <asp:ListItem Value="SAL" Selected="True" meta:resourcekey="SalesDept">Sales Dept.</asp:ListItem>
                    <asp:ListItem Value="CLI" meta:resourcekey="Clients">Important Clients</asp:ListItem>
                    <asp:ListItem Value="AGT" meta:resourcekey="Agents">Agents</asp:ListItem>
                </asp:DropDownList>
            </div>
            <br class="hidden-xs"/><br class="hidden-xs"/>
            <asp:LinkButton ID="lbtnQuery" runat="server" CssClass="form-control input-sm btn-primary text-center" Width="100%" ToolTip="" meta:resourcekey="tipQuery" OnClick="lbtnQuery_Click"> <span class="glyphicon glyphicon-search" style="font-size:large;"></span></asp:LinkButton>
            <p></p><%--没有此行(或&nbsp;)，上面的按钮在手机模式(xs)下，只有上半部可以点击！--%>
        </div>

        <div class="col-sm-10 well well-sm">
            <div class="panel">
                <div class="panel-heading btn-primary">
                    <h6 class="panel-title" id="section-2"><asp:Literal ID="Literal1" runat="server" meta:resourcekey="OfficeInfo"></asp:Literal></h6>
                </div>
                <div class="panel-body">
                    <div class="table-responsive">
                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" style="min-width:800px;width:100%;" class="table-hover"
                            DataKeyNames="id" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None">
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <input name="KEY" type="radio" value='<%# Eval("id") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="id" HeaderText="ID" ReadOnly="True" SortExpression="id"  meta:resourcekey="id1" />
                                <asp:BoundField DataField="name" HeaderText="Name" SortExpression="name"  meta:resourcekey="name1" />
                                <asp:BoundField DataField="status" HeaderText="Status" SortExpression="status"  meta:resourcekey="status1" />
                                <asp:BoundField DataField="rank" HeaderText="rank" SortExpression="rank"  meta:resourcekey="rank1" />
                                <asp:CheckBoxField DataField="api_enabled" HeaderText="api_enabled" SortExpression="api_enabled" meta:resourcekey="api_enabled"/>
                                <asp:CheckBoxField DataField="group_book" HeaderText="group_book" SortExpression="group_book"  meta:resourcekey="group_book" />
                                <asp:BoundField DataField="default_currency" HeaderText="default_currency" SortExpression="default_currency"  meta:resourcekey="default_currency" />
                                <asp:BoundField DataField="valid_date" HeaderText="Valid Date" SortExpression="valid_date"  meta:resourcekey="valid_date" DataFormatString="{0:d}" />
                                <asp:BoundField DataField="expired_date" HeaderText="Expiry" SortExpression="expired_date"  meta:resourcekey="expired_date" DataFormatString="{0:d}" />
                                <asp:BoundField DataField="dcs_airport" HeaderText="Dep. Airport" SortExpression="dcs_airport"  meta:resourcekey="dcs_airport" />
                                <asp:CheckBoxField DataField="check_deposit" HeaderText="check_deposit" SortExpression="check_deposit"  meta:resourcekey="check_deposit" Visible="false" />
                                <asp:TemplateField HeaderText="Deposit Balance" meta:resourcekey="deposit_balance" Visible="false">
                                    <ItemTemplate>
                                        <%# Eval("deposit_currency") + "" + Eval("deposit_balance", "{0:N}")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="done_user" HeaderText="User" SortExpression="done_user"  meta:resourcekey="done_user" />
                                <asp:BoundField DataField="done_time" HeaderText="Op. Time" SortExpression="done_time"  meta:resourcekey="done_time" />
                            </Columns>
                            <RowStyle BackColor="#EFF3FB" />
                            <EditRowStyle BackColor="#2461BF" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>

                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                            SelectCommand="bll_airline_get_offices_by_type" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                            <SelectParameters>
                                <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                                <asp:ControlParameter ControlID="lstOfficeTypes" Name="office_type" PropertyName="SelectedValue" Type="String" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </div>
                    <div class="btn-group">
                        <asp:Button ID="btnRoles" runat="server" CssClass="btn btn-sm btn-default" Text="Roles..." meta:resourcekey="Roles" OnClick="btnRoles_Click" />
                        <asp:Button ID="btnUsers" runat="server" CssClass="btn btn-sm btn-default" Text="Users..."  meta:resourcekey="Users" OnClick="btnUsers_Click" />
                        <asp:Button ID="btnDelete" runat="server" CssClass="btn btn-sm btn-default" Text="Delete" OnClick="btnDelete_Click"  meta:resourcekey="Delete" />
                        <asp:Button ID="btnLogs" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnLog_Click" Text="Logs..."  meta:resourcekey="Logs" />
                    </div>

                    <div class="well well-sm">
                         <asp:Label ID="Label5" runat="server" Text="Status:" meta:resourcekey="Status"></asp:Label>
                        <asp:DropDownList ID="lstStatus" runat="server">
                            <asp:ListItem Selected="True" Value="V" meta:resourcekey="Valid">Valid</asp:ListItem>
                            <asp:ListItem Value="L" meta:resourcekey="Locked">Locked</asp:ListItem>
                        </asp:DropDownList>
                        &nbsp;<asp:Label ID="Label18" runat="server" Text="Dafault Currency:" meta:resourcekey="DafaultCurrency"></asp:Label>
                        <asp:DropDownList ID="lstDefCurrency2" runat="server" 
                            DataSourceID="sqlCurrencies" DataTextField="code" DataValueField="code">
                        </asp:DropDownList>
                        &nbsp;<asp:Button ID="btnSetStatus" runat="server" CssClass="btn btn-sm btn-default" Text="Set Status" OnClick="btnSetStatus_Click"  meta:resourcekey="SetStatus"/>
                        <asp:Label ID="Label9" runat="server" Text="Max Seats Per Day:" Visible="False" meta:resourcekey="MaxSeatsPerDay" Enabled="False" ForeColor="#CC0000"></asp:Label>
                        <asp:TextBox ID="txtMaxSeats2" runat="server" Width="58px" Visible="False" Enabled="False" ForeColor="#CC0000">999999</asp:TextBox>
                        <asp:Button ID="btnSetMaxSeats" runat="server" Text="Set Max Seats_X" OnClick="btnSetMaxSeats_Click" Visible="False"  meta:resourcekey="SetMaxSeats" Enabled="False" ForeColor="Red" />
                    </div>

                    <div class="well well-sm">
                         <asp:Label ID="Label10" runat="server" Text="Valid Date:" meta:resourcekey="ValidDate"></asp:Label>
                        <asp:TextBox ID="txtValidDate2" runat="server" Width="90px"></asp:TextBox>
                        -
                        <asp:TextBox ID="txtExpiredDate2" runat="server" Width="88px"></asp:TextBox>
                        <asp:Button ID="btnSetValidDate" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnSetValidDate_Click" Text="Set Valid Date"  meta:resourcekey="SetValidDate" />
                    </div>

                    <div class="well well-sm">
                         <asp:Label ID="Label12" runat="server" Text="Rank:" meta:resourcekey="Rank"></asp:Label>
                        <asp:TextBox ID="txtRank2" runat="server" MaxLength="2" Width="29px"></asp:TextBox>
                        <asp:CheckBox ID="chkGroup2" runat="server" Text="Allow Group Reservation" meta:resourcekey="AllowGroup"/>
                        <asp:CheckBox ID="chkDeposit2" runat="server" Text="chkDeposit_X" meta:resourcekey="chkDeposit" Checked="True" Enabled="False" ForeColor="Red" Visible="False" />
                        <asp:Button ID="btnSetRank" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnSetRank_Click" Text=" Set "  meta:resourcekey="Set" Width="100px" /> 
                        <asp:Label ID="Label15" runat="server" Text="Currency:_X" meta:resourcekey="Currency" Enabled="False" ForeColor="Red" Visible="False"></asp:Label>&nbsp;
                        <asp:DropDownList ID="lstCurrencies2" runat="server" DataSourceID="sqlCurrencies" DataTextField="code" DataValueField="code" Enabled="False" ForeColor="Red" Visible="False"></asp:DropDownList>
                        <asp:Label ID="Label16" runat="server" Text="Balance:" meta:resourcekey="Balance" Enabled="False" ForeColor="Red" Visible="False"></asp:Label>
                        <asp:TextBox ID="txtBalance2" runat="server" Width="98px" Enabled="False" ForeColor="Red" Visible="False">0</asp:TextBox>
                        <asp:Button ID="btnSetDeposit" runat="server" OnClick="btnSetDeposit_Click" Text="Set_X" Width="100px" meta:resourcekey="Set" Enabled="False" ForeColor="Red" Visible="False" />
                        <asp:Button ID="btnAddDeposit" runat="server" OnClick="btnAddDeposit_Click" Text="Add_X" meta:resourcekey="AddDeposit" Width="100px" Enabled="False" ForeColor="Red" Visible="False"/>
                    </div>
                    <asp:Label ID="lblError" runat="server" CssClass="ifdMessage"></asp:Label>

                    <div class="well well-sm">
                         <asp:Label ID="Label3" runat="server" Font-Bold="True" Text="Add New Office" meta:resourcekey="AddNewOffice"></asp:Label><br />
                        <asp:Label ID="Label2" runat="server" Text="Office ID:" meta:resourcekey="OfficeID"></asp:Label>
                        <asp:TextBox ID="txtOfficeId" runat="server" Width="113px" MaxLength="12"></asp:TextBox>
                        <asp:Label ID="Label4" runat="server" Text="Full Name:" meta:resourcekey="FullName"></asp:Label>
                        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                        <asp:Label ID="Label7" runat="server" Text="DCS Airport:" meta:resourcekey="DCSAirport"></asp:Label>
                        <asp:TextBox ID="txtDcsAirport" runat="server" MaxLength="4" Width="54px"></asp:TextBox>
                        <br />
                        <asp:Label ID="Label11" runat="server" Text="Rank:" meta:resourcekey="Rank"></asp:Label>
                        <asp:TextBox ID="txtRank" runat="server" MaxLength="2" Width="34px"></asp:TextBox>
                        &nbsp;<asp:CheckBox ID="chkGroup" runat="server" Text="Allow Group Reservation" meta:resourcekey="AllowGroup"/>&nbsp;
                        <asp:Label ID="Label17" runat="server" Text="Dafault Currency:" meta:resourcekey="DafaultCurrency"></asp:Label>
                        <asp:DropDownList ID="lstDefCurrency" runat="server" 
                            DataSourceID="sqlCurrencies" DataTextField="code" DataValueField="code">
                        </asp:DropDownList>
                        <br />
                        <asp:Label ID="Label6" runat="server" Text="Valid Date:" meta:resourcekey="ValidDate"></asp:Label>
                        <asp:TextBox ID="txtValidDate" runat="server" Width="79px"></asp:TextBox>
                        -
                        <asp:TextBox ID="txtExpiredDate" runat="server" Width="80px"></asp:TextBox>&nbsp;&nbsp; &nbsp;
                        <asp:Label ID="Label8" runat="server" Text="Max Seats Per Day:" Visible="False" meta:resourcekey="MaxSeatsPerDay" Enabled="False"></asp:Label>
                        <asp:TextBox ID="txtMaxSeats" runat="server" Width="64px" Visible="False" Enabled="False">999999</asp:TextBox><br />
                        <asp:Button ID="btnAdd" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnAdd_Click" Text=" Add "  meta:resourcekey="Add" />
                        <asp:CheckBox ID="chkDeposit" runat="server" Text="chkDeposit_X" meta:resourcekey="chkDeposit" Checked="True" Enabled="False" ForeColor="Red" Visible="False"/>&nbsp;
                        <asp:Label ID="Label13" runat="server" Text="Currency:" meta:resourcekey="Currency" Enabled="False" ForeColor="Red" Visible="False"></asp:Label>
                        <asp:DropDownList ID="lstCurrencies" runat="server" DataSourceID="sqlCurrencies" DataTextField="code" DataValueField="code" Enabled="False" ForeColor="Red" Visible="False"></asp:DropDownList>
                        <asp:Label ID="Label14" runat="server" Text="Balance:" meta:resourcekey="Balance" Enabled="False" ForeColor="Red" Visible="False"></asp:Label>
                        <asp:TextBox ID="txtBalance" runat="server" Width="98px" Enabled="False" ForeColor="Red" Visible="False">0</asp:TextBox>
                    </div>
                </div>

                <asp:SqlDataSource ID="sqlCurrencies" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                    SelectCommand="bll_currency_get_codes"  DataSourceMode="DataReader" SelectCommandType="StoredProcedure">
                </asp:SqlDataSource>
            </div>
        </div>
    </div>

    </div>
    </form>

    <script src="JS/ScrollableGridPlugin.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var win_height = parseInt($(window).height());
            var tab_new_height= win_height-50-100;//菜单占50， 为便于操作留空100
            if ($('#<%=GridView1.ClientID %>').height()>tab_new_height)
                $('#<%=GridView1.ClientID %>').Scrollable({ ScrollHeight: tab_new_height });
        });
    </script>

</asp:Content>
